package cn.jji8.patronSaint.quick.vision;

import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.entity.Player;

public class StraightLine {
    /**
     * 给某玩家显示连接这两点的直线
     * @param density 用多少个点组成这条线
     * */
    @SuppressWarnings("unused")
    public static void straightLine(Location l1, Location l2, Player player, int density){
        double xll = l1.getX()-l2.getX();
        double yll = l1.getY()-l2.getY();
        double zll = l1.getZ()-l2.getZ();
        xll/=density;
        yll/=density;
        zll/=density;
        for (int i = 0; i < density; i++) {
            l2.add(xll,yll,zll);
            player.spawnParticle(Particle.SOUL_FIRE_FLAME,l2,0);
        }
    }
}
